package com.example.maomao.controller;

import com.example.maomao.mapper.AboutMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class LishiController {

    @Autowired
    AboutMapper aboutMapper;

    @GetMapping("/lishi")
    public String lishi(){

        return "lishi";
    }

    @PostMapping("/lishi")
    public String postlishi(@RequestParam(name = "name") String name,
                            @RequestParam(name = "phone") String phone,
                            @RequestParam(name = "message") String message){
        System.out.println(name+phone+message);
        aboutMapper.insertIn(name,phone,message);
        return "lishi";
    }

}
